package com.songsong.myblog2.mapper;

import com.songsong.myblog2.domain.Article;
import com.songsong.myblog2.domain.Photo;
import com.songsong.myblog2.domain.User;
import com.songsong.myblog2.domain.UserImage;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/12/24 0024.
 */
@Mapper
@Component
public interface UserMapper {
    //通过用户code查找用户对象
    public User findUser(String username);

    //添加用户
    public void addUser(User user);

    //添加用户图片
    public void addUserImage(UserImage userImage);

    //获取用户图片
    List<UserImage> getUserImage(String username);

    //批量删除用户图片
    public void deleteUserImage(Object[] imageId);

    //单个删除用户图片
    void deleteUserImageAlone(String userImageId);

    //获取用户头像url
    String getUserPhoto(String userphone);

    //更新用户头像
    void updateUserHead(Photo photo);

    //新增用户头像
    void insertUserPhoto(Photo photo);

    //获取用户个人信息
    User getUserPersonalInfoByUsername(String userPhone);

    //修改个人信息
    void savePersonalDate(User user);

    List<User> getUserManagement();

    void updateUserToAdmin(String userPhone);

    void updateAdminToUser(String userPhone);

    void deteUser(String userPhone);

    void updatePassword(String phone, String password, String salt);

    int getUserNum();
}
